

function addSensorbitCod(Blockly) {





   //红外接收模块
  Blockly.Python.microbit_irInit = function(block) {
    var dropdown_irPort = this.getFieldValue('irPort');
    Blockly.Python.definitions_['import_microbit'] = 'from microbit import *';
    Blockly.Python.definitions_['import_nec_ir'] = 'from sensor import nec_ir';
    Blockly.Python.definitions_['import_nec_irInit'] = 'nec_ir.init('+ dropdown_irPort +')';
    return '';
  }

  //红外接收模块
  Blockly.Python.microbit_ir = function(block) {
    var dropdown_mappingValue = this.getFieldValue('mappingValue');
    Blockly.Python.definitions_['codeLine_irData'] = '  key = nec_ir.get_code()';
    var code = "key == "+dropdown_mappingValue;
    return [code];
  }

   //红外接收模块
   Blockly.Python.microbit_irLogic = function(block) {
      var code = "nec_ir.get_code()";
    return [code];
  }

    return Blockly;
}

module.exports = addSensorbitCod;

